//
//  CMPListView.m
//  iBaby365v2
//
//  Created by admin on 14/12/8.
//  Copyright (c) 2014年 suplus. All rights reserved.
//

#import "CMPListView.h"
#import "SPExpertclass.h"
#import "UIImageView+AFNetworking.h"
#import "MyUILabel.h"

@interface CMPListView ()
@property (weak, nonatomic) IBOutlet UIImageView *ivonView;
@property (weak, nonatomic) IBOutlet UILabel *titleView;
@property (weak, nonatomic) IBOutlet UILabel *descView;




@end
@implementation CMPListView

+(instancetype)headerView
{
    return [[[NSBundle mainBundle] loadNibNamed:@"CMPListView" owner:nil options:nil] lastObject];
}



-(void)setSpexpercontent:(SPExpertclass *)spexpercontent
{
    
    self.titleView.text = spexpercontent.title;
    self.descView.text = spexpercontent.introduction;
//    self.descView.font = [UIFont systemFontOfSize:12];
     NSLog(@"%f-%f-%f-%f",self.descView.frame.origin.x,self.descView.frame.origin.y,self.descView.frame.size.width,self.descView.frame.size.height);
    MyUILabel *descView1 = [[MyUILabel alloc] initWithFrame:CGRectMake(self.descView.frame.origin.x, self.descView.frame.origin.y, self.descView.frame.size.width, self.descView.frame.size.height)];
    descView1.numberOfLines = 0;
    descView1.textAlignment = NSTextAlignmentLeft;
    descView1.backgroundColor = [UIColor whiteColor];
    descView1.textColor = [UIColor grayColor];
    descView1.lineBreakMode = NSLineBreakByWordWrapping;
    descView1.font = [UIFont systemFontOfSize:12];
    [descView1 setVerticalAlignment:VerticalAlignmentTop];
    descView1.text = self.descView.text;
    self.descView =descView1;
    [self addSubview:self.descView];
    [self.ivonView setImageWithURL:[NSURL URLWithString:spexpercontent.photo] placeholderImage:nil];
    
}
/**
 *  划线
 *
 *  @param rect <#rect description#>
 */
-(void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
    CGContextFillRect(context, rect);
    
//    //上分割线，
//    CGContextSetStrokeColorWithColor(context, [UIColor colorWithHexString:@"ffffff"].CGColor);
//    CGContextStrokeRect(context, CGRectMake(5, -1, rect.size.width - 10, 1));
    
    //下分割线
    CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:49.0/255.0 green:48.0/255.0 blue:46.0/255.0 alpha:0.2].CGColor);
    CGContextStrokeRect(context, CGRectMake(5, rect.size.height, rect.size.width - 10, 1));
    
}

@end
